#define _CRT_SECURE_NO_WARNINGS 1
#include "SingleList.h"

//void test1()
//{
//	SLNode* plist1 = BuyNode(1);
//	SLNode* plist2 = BuyNode(2);
//	SLNode* plist3 = BuyNode(3);
//	SLNode* plist4 = BuyNode(4);
//
//	plist1->next = plist2;
//	plist2->next = plist3;
//	plist3->next = plist4;
//
//	SLNodePrint(plist1);
//}


void test2()
{
	SLNode* plist = NULL;
	//测试尾插
	SLNodepushback(&plist, 1);
	SLNodepushback(&plist, 2);
	SLNodepushback(&plist, 3);
	SLNodepushback(&plist, 4);
	SLNodePrint(plist);

	//测试销毁链表
	DestorySL(&plist);

	//测试删除pos节点的下一个节点
	//SLNode* find = SLFind(plist, 4);
	//slpopposback(find);
	//SLNodePrint(plist);

	//测试删除pos节点
	//SLNode* find = SLFind(plist, 4);
	//slpoppos(&plist,find);
	//SLNodePrint(plist);


	//测试在指定位置之后插入数据
	//SLNode* find = SLFind(plist, 1);
	//SLposback(find,66);
	//SLNodePrint(plist);

	//测试在指定位置之前插入数据
	//SLNode* find = SLFind(plist, 4);
	//SLposfront(&plist,find,100);
	//SLNodePrint(plist);

	//测试查找
	//SLNode* find = SLFind(plist,99);
	//if (find == NULL)
	//{
	//	printf("找不到!");
	//}
	//else
	//{
	//	printf("找到了!");
	//}

	//测试头删
	//SLpopfront(&plist);
	//SLNodePrint(plist);//2 3 4
	//SLpopfront(&plist);
	//SLNodePrint(plist);//3 4
	//SLpopfront(&plist);
	//SLNodePrint(plist);//4
	//SLpopfront(&plist);
	//SLNodePrint(plist);//NULL
	//SLpopfront(&plist);
	//SLNodePrint(plist);


	//测试尾删
	//SLpopback(&plist);
	//SLNodePrint(plist);//1 2 3
	//SLpopback(&plist);
	//SLNodePrint(plist);//1 2
	//SLpopback(&plist);
	//SLNodePrint(plist);//1
	//SLpopback(&plist);
	//SLNodePrint(plist);//NULL


	//测试头插
	//SLpushfront(&plist,100);
	//SLNodePrint(plist);
	//SLpushfront(&plist,99);
	//SLNodePrint(plist);
}

int main()
{
	//test1();
	test2();
	return 0;
}